//author:jxx
//此处是对表单的方法，组件，权限操作按钮等进行任意扩展(方法扩展可参照SellOrder.js)

import { h, resolveComponent } from 'vue';
let extension = {
    components: {//动态扩充组件或组件路径
        //表单header、content、footer对应位置扩充的组件
        gridHeader:'',//{ template: "<div>扩展组xx件</div>" },
        gridBody: '',
        gridFooter: '',
        //弹出框(修改、编辑、查看)header、content、footer对应位置扩充的组件
        modelHeader: '',
        modelBody: '',
        modelFooter: ''
    },
    buttons: {view: [], box:[],  detail:[]},//扩展的按钮
    methods: {//事件扩展
       onInit() {
            this.single=true;
            //设置单单元格合并
            this.initFirstColumn();
       },
       toggleRowSelection(row){
        console.log("选择",row)
       },
       rowChange(row) {
        if(row.auditStatus!=0){this.$Message.error("请选择未审核的数据！");this.$refs.table.$refs.table.clearSelection();}
        return false;
      },
       initFirstColumn() {
        //在第一行后面动态添加一行
        this.columns.splice(1, 0, {
          title: "用户信息",
          field: "用户信息",
          width: 220,
          render: (h, { row, column, index }) => {
              //console.log(this.http.ipAddress ,row.image)
            //下面所有需要显示的信息都从row里面取出来
            return h(
              "div",
              {
                style: { display: "flex", cursor: 'pointer', },
              },
              [
                // h(
                //   "img",
                //   {
                //     src:row.image,
                //     style: { "width": "70px", height: "90px", "object-fit": "cover" },
                //   },
                // ),
                h(
                  "div",
                  {
                    props: {},
                    style: { "margin-left": "15px" },
                  },
                  [
                    h("div", { style: { "font-size": "12px", "color": "#459fff", "margin-bottom": "8px", "font-weight": "bold" } },
                      [h("span", {},"姓名："+ row.name),
                      row.cardType == "01" ?h("span", { style: { "margin-left": "20px" ,"color": "#68c99a"} },'身份证' ):
                      row.cardType == "02" ?h("span", { style: { "margin-left": "20px" ,"color": "#10c33a"} },'护照' ):
                      row.cardType == "03" ?h("span", { style: { "margin-left": "20px", "color": "#90c23a"} },'港澳通行证' ):
                      h("span", { style: { "margin-left": "20px", "color": "#67c23a", } },'台胞证' )]
                    ),
                    h("div", { style: { "font-size": "12px", "color": "#459fff", 'line-height': '20px' } }, "证件号：" +row.ident || '无身份证信息'),
                    h("div", { style: { "font-size": "12px", "color": "#459fff", 'line-height': '20px' } }, "电话：" + row.phone),
                    h("div", { style: { "font-size": "12px", "color": "#459fff", 'line-height': '20px' } }, "卡号：" + row.cardno),
                  ]
                )])
          }
        })
      },
      rowClick({ row, column, event }) { //查询界面table点击行选中当前行
        //console.log(row,column,event);
       if(row.auditStatus==0){this.$refs.table.$refs.table.toggleRowSelection(row)}
       else{this.$Message.error("请选择未审核的数据！");this.$refs.table.$refs.table.clearSelection();}
        return true;
       },
    }
};
export default extension;